/*
 * @Author: wang cong wangc9832@163.com
 * @Date: 2023-05-24 17:35:09
 * @LastEditors: wang cong wangc9832@163.com
 * @LastEditTime: 2023-07-05 17:41:34
 * @FilePath: /ams-front/src/api/asset/amsConfirmationManage.ts
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
import { downloadBlob } from '@/utils/file/download';
const api = '/amsConfirmation';
// 根据递增生效日、计价起始日期、计价结束日期、递增周期、递增类型、递增值、单价,生成其他租金条款
export const getTermByIncreaseInfo = (params?: any) =>
  defHttp.post({ url: api + '/getTermByIncreaseInfo', params });

//确交记录表_驳回
export const unapprove = (params?: any) =>
  defHttp.post<BasicFetchResult<any>>({ url: api + '/unapprove', params });
//确交记录表_审批
export const approve = (params?: any) =>
  defHttp.post<BasicFetchResult<any>>({ url: api + '/repeat', params });
// 确交记录表_查询是否有重复的确交记录
export const repeat = (params?: any) =>
  defHttp.post<BasicFetchResult<any>>({ url: api + '/repeat', params });
//确交记录表_单条查询
export const getDetailById = (id?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/detail/' + id });
/**
 * 查询确交记录表分页
 * @author gxt
 * @date 2023-05-24 10:53:59
 */
export const page = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/page', params });
/**
 * 查询确交记录表不分页
 * @author gxt
 * @date 2023-05-24 10:53:59
 */
export const list = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: api + '/list', params });
/**
 * 添加确交记录表
 * @author gxt
 * @date 2023-05-24 10:53:59
 */
export const add = (params?: any) =>
  defHttp.post({ url: api + '/add', params });
/**
 * 修改确交记录表
 * @author gxt
 * @date 2023-05-24 10:53:59
 */
export const edit = (params?: any) =>
  defHttp.post({ url: api + '/edit', params });

/**
 * 删除确交记录表
 * @author gxt
 * @date 2023-05-24 10:53:59
 */
export const del = (ids: string[]) =>
  defHttp.post({ url: api + '/delete', params: ids });
/**
 * 导出确交记录表
 * @author gxt
 * @date 2023-05-24 10:53:59
 */
export const exp = (params?: any) => {
  return new Promise<void>((resolve, reject) => {
    defHttp
      .get(
        { responseType: 'blob', url: api + '/export', params },
        { isReturnNativeResponse: true }
      )
      .then((res) => {
        downloadBlob(res);
        resolve();
      })
      .catch(() => {
        reject();
      });
  });
};
